package org.chuan.base.listener;

import org.chuan.base.service.IAutoScanPermissionService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener // 把当前的类交给 springIOC容器
//@Component
public class InitPermissionListener implements ServletContextListener {

    @Autowired
    private IAutoScanPermissionService autoScanPermissionService;
    /*
        在容器初始化的时候执行
     */
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("============================");
        autoScanPermissionService.scan();
        System.out.println("============================");
    }

    /*
        在容器销毁的时候执行
     */
    @Override
    public void contextDestroyed(ServletContextEvent sce) {



    }
}
